package com.testplatform.aitestplatform.service.impl;

import java.util.Arrays;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.testplatform.aitestplatform.mapper.TestEnvironmentMapper;
import com.testplatform.aitestplatform.domain.TestEnvironment;
import com.testplatform.aitestplatform.service.ITestEnvironmentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * DEV环境Service业务层处理
 * 
 * @author carrier
 * @date 2025-10-26
 */
@Service
public class TestEnvironmentServiceImpl extends ServiceImpl<TestEnvironmentMapper, TestEnvironment> implements ITestEnvironmentService
{
    @Autowired
    private TestEnvironmentMapper testEnvironmentMapper;

    /**
     * 查询DEV环境
     * 
     * @param id DEV环境主键
     * @return DEV环境
     */
    @Override
    public TestEnvironment selectTestEnvironmentById(Long id)
    {
        return getById(id);
    }

    /**
     * 查询DEV环境列表
     * 
     * @param testEnvironment DEV环境
     * @return DEV环境
     */
    @Override
    public List<TestEnvironment> selectTestEnvironmentList(TestEnvironment testEnvironment)
    {
        return testEnvironmentMapper.selectTestEnvironmentList(testEnvironment);
    }

    /**
     * 新增DEV环境
     * 
     * @param testEnvironment DEV环境
     * @return 结果
     */
    @Override
    public int insertTestEnvironment(TestEnvironment testEnvironment)
    {
        return save(testEnvironment) ? 1 : 0;
    }

    /**
     * 修改DEV环境
     * 
     * @param testEnvironment DEV环境
     * @return 结果
     */
    @Override
    public int updateTestEnvironment(TestEnvironment testEnvironment)
    {
        return updateById(testEnvironment) ? 1 : 0;
    }

    /**
     * 批量删除DEV环境
     * 
     * @param ids 需要删除的DEV环境主键
     * @return 结果
     */
    @Override
    public int deleteTestEnvironmentByIds(Long[] ids)
    {
        return removeByIds(Arrays.asList(ids)) ? 1 : 0;
    }

    /**
     * 删除DEV环境信息
     * 
     * @param id DEV环境主键
     * @return 结果
     */
    @Override
    public int deleteTestEnvironmentById(Long id)
    {
        return removeById(id) ? 1 : 0;
    }
}
